﻿<?php
header("Cache-Control: no-cache");

$default_lang = 'en';
$dir_lang = './languages/';

$languages = array('en', 'fr'); 

if (isset($_GET['lang']) && in_array($_GET['lang'], $languages)) 
{
    $lang = $_GET['lang'];
}
else if (isset($_COOKIE['lang']) && in_array($_COOKIE['lang'], $languages)) 
{
    $lang = $_COOKIE['lang'];
}

if (!empty($lang)) 
{
    setcookie('lang', $lang);
}

include($dir_lang . $default_lang . '.php');
if (!empty($lang) && $lang != $default_lang && is_file($dir_lang. $lang . '.php')) 
{
    include($dir_lang . $lang . '.php');
}

?>